package srt.tool;

import java.util.List;

import srt.ast.WhileStmt;
import srt.ast.visitor.impl.DefaultVisitor;
//Visitor to update all given whileStmts
public class ReplacementVisitor extends DefaultVisitor{

	private List<WhileStmt> whileStmts;
	
	public ReplacementVisitor(List<WhileStmt> whileStmts) {
		super(true);
		this.whileStmts = whileStmts;
	}
	
	@Override
	public Object visit(WhileStmt whileStmt) {
		System.out.println("replaced :" + whileStmts.get(0));
		whileStmt = (WhileStmt) whileStmts.remove(0);
		return super.visit(whileStmt);
	}

}
